/**
 * @file LogoutHandler.cs
 * @author Zane Mayo
 * @date 8/5/2009
 */

using System;

namespace MxitAPI {
	
	
	public class LogoutHandler : Handler {
		
		public LogoutHandler() : base ( typeof( LogoutProtocolMessage ) ) {
		}
		
		/**
		 * If the logout was successful set the connection status to disconnected, otherwise throw an exception
		 */
		protected override void HandleSpecificResponseProtocolMessage ( ProtocolMessage message ) {
			if ( message.ErrorCode == ErrorCode.NoError )
				Connection.Instance.ConnectionStatus = ConnectionStatus.Disconnected;
			else
				throw new MxitProtocolMessageException( "Logout not successfully completed " , message.ErrorCode );
		}
		
		
	}
}
